{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "29c75e93-09f6-4ab0-ac50-031b634807aa",
   "metadata": {},
   "outputs": [],
   "source": [
    "pip install --upgrade pandas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "49bfb4de-6fff-47a8-aec1-cd8d3b951e6e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "# 创建包含 5 位员工信息的 DataFrame\n",
    "data = {\n",
    "    '姓名': ['张三', '李四', '王五', '赵六', '孙七'],\n",
    "    '性别': ['男', '女', '男', '女', '男'],\n",
    "    '年龄': [25, 30, 35, 40, 45],\n",
    "    '月工资收入': [5000, 6000, 7000, 8000, 9000]\n",
    "}\n",
    "df = pd.DataFrame(data)\n",
    "# 选择月工资收入这列数据\n",
    "print(df['月工资收入'])\n",
    "# 增加一位员工信息\n",
    "new_employee = {'姓名': '赵一平', '性别': '男', '年龄': 34, '月工资收入': 7000}\n",
    "df = df.append(new_employee, ignore_index=True)\n",
    "# 修改赵一平的月工资收入\n",
    "df.loc[df['姓名'] == '赵一平', '月工资收入'] = 8000\n",
    "# 删除第 2 位员工的数据\n",
    "df = df.drop(1)\n",
    "# 筛选出月工资收入大于 6000 元的员工数据\n",
    "filtered_df = df[df['月工资收入'] > 6000]\n",
    "print(filtered_df)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "59466534-9632-4464-be0e-8e132722ac98",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9306b57c-4458-47b5-9a78-fc20c5b4860e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
